Adolphson & Falk is a swedish pop band that has been around since the 70's. Their sound has changed over the years, from acoustic to synth, and then back to acoustic again. They released one album in english (From here to eternity), but except for that, the lyrics are in swedish.
At the end of the album "Över tid och rum" from 1984 is an audible data signal present, and this article is about the decoding of that signal.
I visit the municipal library in Lund to see if they have any AF records that I don't already have. Even at this time, music was not as easily available as it is today, especially not old albums from domestic bands.
I don't find any albums that I don't already have, but I find a reference to a sheet music book, and in this one I find some technical history mentioning that the last track on the LP version of "Över tid och rum" contains a message in form of a data signal.
When the book was printed (1996), they didn't know if anyone had been able to decode the message. Naturally, this catches my interest and I return home to listen to the CD version, which however does not contain the signal.
Later that autumn I receive a call from the owner of a store for used records, telling me that he has got a LP version of the very record above. If I hadn't read about the signal, I wouldn't have been interested, but now I bought it (after listening to it in the store to make sure the signal was present).
Since I don't own a turntable, the record is put away for a while, until I have the opportunity to sample it. I peek around in the wav-file created, only to find out that it wasn't totally obvious how the data was encoded. If you want to listen to the signal, it is present here.
I got some spare time, and decide to look into the signal in depth. The sound editing software Goldwave comes with a decent spectrum analyzer, revealing two distinct peaks in the spectrum, pictured below (they are partially hidden by noise and low resolution). This indicates two different frequencies being used, that is, FSK (frequency shift keying).
I use the same software to apply a band pass filter, and after some experimenting with the filter values, the result below is acheived. The signal consists of nine distinct groups of data, so called "records", each 2.3 seconds in length and separated by 270 ms of silence. Measuring time over several periods yields the frequencies 3.774 kHz and 5.000 kHz.
The theory behind FSK is that one frequency is used for encoding 1's, and the other frequency is used for 0's. After examining the records, I see the following relationship:
The big questions right now is: which frequency corresponds to 0, and which one is 1? Is data sent MSB or LSB first? There seems to be no parity bit, which is a pity, as it could have been used to answer the first question.
To start with, I write down all 1's and 0's from record #0, testing the four possible combinations (inverting the bits, and reversing the bit order), but none of them resembles ASCII. And ASCII has been used for more than 40 years, so there is a great probability that a computer from 1984 uses it. Anyhow, the record #0 contains numerous adjacent repetitions of the same character, and might also be a header, only meant to be read by a computer, so I move on to record #1, writing down these bits as well, but it still doesn't resemble text.
I type all bits from the first two records into a text file, and writes a piece of software in TurboPascal to show all possible combinations of data, and also adds an offset ranging from 0 to 255. Even though ASCII is not being used, the distance between the characters in the alphabet should be the same, so with the right offset, something readable should appear. But it doesn't. I perform a frequency analysis of the characters present, and find that eight characters are very frequent, and with distances that usually doesn't occur in written text. On the cover of the album is a rose, digitized with low resolution. Maybe the signal isn't a text message, but a picture?
After plotting the first 132 x 2 bytes as pixels of gray scale, something that resembles a picture can be seen, at least when using some imagination. Now having some practice, I quickly decode the remaining six records (record #8 contains apart from the start byte only the same character over and over again, so I ignore this record).
As all records starts with two identical bytes, I ignore them as it probably is a preamble. This leaves us with 130 bytes of data, which is close to 128, a common value in computing. Probably, a two byte checksum is added to the end of data. This means we have 8 * 128 = 1024 bytes of data. This could make up a 32 by 32 pixels picture, which is almost exactly what is found on cover of the album.
I write another piece of software, this time in Visual C++, to plot such a picture using the data values as gray scales. But the outcome doesn't make any sense at all, apart from a sequence of six bytes that are repeated with equal distances. The question is, could computers from the early 80's display 256 colors?
If Adolphson & Falk wanted their signal to be decoded, the origin probably isn't some kind of super computer, but more likely the kind that could be found in households at this time. Like for example, Commodore 64, which only could display 16 colors. Maybe all bits aren't being used, and my frequency analysis indicated that character 44-54 was the most frequent, indicating 16 colors.
Ok, so maybe it isn't as simple as a raw picture; time to stop guessing and become a little more systematic. I paste my records in an Excel sheet, one record per column. Now, with this overview, I mark the start sequences and the six repeated bytes recurring every 20-30 bytes. This makes me confident that the theory about 128 bytes of data is correct, and that the three first and the last character are control characters and checksum. Then I read on the cover "Thanks to Atari and USR-data for digital image signal". So from now on, I assume I am dealing with something created on an Atari machine.
I find an excellent format site, describing multiple image formats used by Atari ST, but none of them matches the bitstream that has been keeping me busy for a while now. So I take a break for a few days, but soon is drawn back to my Excel sheet again, and finds a relation between two bytes in the recurring six byte sequence, and the number of bytes that follow until the next six byte sequence.
These two bytes are identical, occurs at the same position in each six byte sequence, and if I invert them and change the bit order, they correspond to the number of bytes that follows until the next six byte sequence. This means that I now know the bit order and bit representation. Sweet!
So, I do some more research on the Internet, and finds out that Atari ST, the most common Atari in the 80's, was released in 1985. That is, one year after the release of the LP record. Clearly, this is not the kind of machine we're dealing with. Time to study the history of previous Atari machines. The result is Atari 400 and 800, both released at the end of the 70's. These were actually capable of displaying 128 colors (and with some tweaking, that number could be doubled). Very good performance for a computer of this time. Or perhabs the performance of the first PC was very low....
From the start, I have suspected that I am dealing with a file stored on a cassette tape, so when I find a technical description of the protocol used to store data on the Atari 410 tape recorder, and compare with my data, I get my theory confirmed. I also learn that byte number two indicates whether the record contains data or not (the empty record had a different character in this position, check!), and that the last byte in each record really is a checksum used for error detection.
The exact frequencies are stated to be 5327 Hz for 1's, 3995 Hz for 0's, and the bit rate is 600 bps, a far more common value than the measured 560 bps. Seems like the motor in the tape recorder used by AF was a bit slower than nominal. Or maybe the turntable I used needs to be calibrated for the nominal 33 rpms, I should look into that...
For a while, I was thinking about finding an old Atari and feed the signal into that to see what happens, but then I found a good software, wav2cas, that converts a sampled Atari cassette to databits, that is, what I did manually. The tape image created by wav2cas can be used by an emulator called Atari800. So, I decide to try this emulator, starting with using wav2cas on my sample, but it doesn't really work. After using Goldwave for lo-pass filtering, volume amplification and removed lead in, the result is a file where the first eight record matches the checksum. The last record doesn't come out right, but it doesn't matter as it only contains 0's (EOF).
Technically, Atari800 is a great emulator, but the documentation of the user interface is far from user friendly, and it also expects you to know the commands used by Atari800. Since I never owned an Atari, I had to find this on the Internet, and finally succeded in making the emulator accepts my tape image. Not even this was straight forward, as an Atari could use four different ways of storing a file, but the first one I tried turned out to work, i e 'CLOAD'.
The program is a so-called loader. Though the main structure is written in Basic, it is actually a machine code program. The Basic part only loops through a list of hard-coded machine code instructions and stores them in RAM. When loading is finished, the line labeled 20 transfers execution to the first address that was written. A common method of writing machine code programs once, when a Basic interpretor was the only user interface available. Trivia: the counter variable used is called 'AF', wonder why? :)
It was a great reward to type 'list' and see what was hidden in the high pitch noise at the end of my LP record. It was not a text file, nor a picture, but a short program. To execute the program and see the text "Adolphson-Falk Över tid och rum" printed over a color cycling background exceeded by far my expectations from when I started the decoding. I can imagine how the author of the program proudly presented it to Thomas Adolphson and Anders Falk in the beginning of the 80's.
Below is the assembly code corresponding to the machine code listning. Thanks goes to Niklas Sandberg for decoding and supplying it!
LDA #0
STA 240+6*256=1776
STA 243+6*256=1779
LDA #122
STA 242+6*256=1778
LDA #9
STA 244+6*256=1780
# Set DOSINI to 0x0600 (Page 6)
LDA #0
STA 12
LDA #6
STA 13
# Set BOOT?
LDA #1
STA 9
# Set Narrow playfield + DMA Display List
LDA #33
STA 47+2*256 = 559
# Set Display List
LDA #131
STA 48+2*256 = 560
LDA #6
STA 49+2*256 = 561
# Set HSCROL to 4 cycles
LDA #4
STA 4+212*256 = 54 276
JMP-LABEL1:
# Read vertical line count
LDA 11+212*256 = 54283 (D40B)
BNE 251
LDX 240+6*256 = 1776
LDA #7
INX
STA 10+212*256 = 54 282 (Wait Sync)
STX 26+208*256 = 53 274 (color playfield)
# Read vertical line count
LDA 11+212*256 = 54 283
CMP #63
BNE 242
LDA 242+6*256 = 1778
DEX
STA 10+212*256 = 54 282 (Wait Sync)
STX 26*208*256 = 53 274 (color playfield)
# Read vertical line count
LDA 11+212*256 = 54 283
CMP #150
BNE 242
INC 240+6*256 = 1776
INC 242+6*256 = 1778
INC 253+6*256 = 1789
LDA 243+6*256 = 1779
CMP #2
BNE 199
LDA #0
STA 243+6*256 = 1779
LDA 244+6*256 = 1780
CLC
ADC #16
STA 244+6*256 = 1780
CMP #16
BCC 243
STA 198+2*256 = 710
JMP 50+6*256 # JMP-LABEL1
DISPLAY-LIST(1667):
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$70 (112) # 8 blank lines
$60 (96) # 7 blank lines
$57 (87) # text mode 2 + h-scroll + load memory scan 151+6*256=1687
$97 (151)
$6 (6)
$7 (7) # text mode 2
$41 (65) # jump and wait for V-scan (131+6*256=1667)
$83 (131)
$6
$0
$0
$0
161 # A
164 # D
175 # O
172 # L
176 # P
168 # H
179 # S
175 # O
174 # N
141 # -
166 # F
161 # A
172 # L
171 # K
0
0
0
188 # \ (Ö if swedish setting)
182 # V
165 # E
178 # R
0
180 # T
169 # I
164 # D
0
175 # O
163 # C
168 # H
0
178 # R
181 # U
173 # M
0
0
0
0
0
0
0
0
0
Is it justified to spend as much time as I did on a task like this? Maybe not, considering I could have worked and made money instead, but there is more to life than money. I learned alot along the journey, let it be about old computers, but as I work with embedded systems, many of the challenges are the same. So for me, the answer to the question is clearly yes.